﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;

namespace SQLComparer
{
    public partial class FormExclude : Form
    {
        public FormExclude()
        {
            InitializeComponent();
        }

        private void FormExclude_Load(object sender, EventArgs e)
        {

            foreach (Exclude list in Exclude.Deserialize())
            {
                listBox1.Items.Add(list);
            }
            listBox1.DisplayMember = "Name";
        }
        private void button1_Click(object sender, EventArgs e)
        {
            List<Exclude> list = Exclude.Deserialize();
            foreach (object o in listBox1.SelectedItems)
            {
                Exclude temp = (Exclude)o;
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].Name == temp.Name)
                    {
                        list.RemoveAt(i);
                        break;
                    }
                }
            }
            Exclude.Serialize(list);
            this.DialogResult = DialogResult.Yes;
        } 
    }
}
